package vn.nt.healthcare.server.ws.model;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import vn.nt.healthcare.server.ws.util.Constants;

@Entity(name = "Reports")
@Table(name = "reports")
public class Reports implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer Id;
	
	@OneToOne
	@PrimaryKeyJoinColumn
	private Sessions session;
	
	@Column(name= "b_name")
	private String bName;
	@Column(name= "b_age")
	private int bAge; // days
	@Column(name= "b_weight")
	private String bWeight;
	@Column(name= "b_height")
	private String bHeight;
	@Column(name= "b_heartBeat")
	private String bHeartBeat;
	@Column(name= "guess_birth")
	private Date   guessBirth;
	@Column(name = "real_age")
	private String realAge;
	private String image;
	@Column(name= "b_state")
	private String bState;

	public Sessions getSession() {
		return session;
	}

	public void setSession(Sessions session) {
		this.session = session;
	}

	public String getbName() {
		return bName;
	}

	public void setbName(String bName) {
		this.bName = bName;
	}

	public int getbAge() {
		return bAge;
	}

	public void setbAge(int bAge) {
		this.bAge = bAge;
	}

	public String getbWeight() {
		return bWeight;
	}

	public void setbWeight(String bWeight) {
		this.bWeight = bWeight;
	}

	public String getbHeight() {
		return bHeight;
	}

	public void setbHeight(String bHeight) {
		this.bHeight = bHeight;
	}

	public String getbHeartBeat() {
		return bHeartBeat;
	}

	public void setbHeartBeat(String bHeartBeat) {
		this.bHeartBeat = bHeartBeat;
	}

	public Date getGuessBirth() {
		return guessBirth;
	}

	public void setGuessBirth(Date guessBirth) {
		this.guessBirth = guessBirth;
	}

	public String getRealAge() {
		return realAge;
	}

	public void setRealAge(String realAge) {
		this.realAge = realAge;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getbState() {
		return bState;
	}

	public void setbState(String bState) {
		this.bState = bState;
	}

	public String getMon() {
		if (session != null) {
			return session.getCustomer().getFirstname() + " "
					+ session.getCustomer().getLastname();
		} else {
			return "";
		}
	}

	public String getDateReport() {
		SimpleDateFormat frmDate = new SimpleDateFormat(Constants.FRM_DATE);
		if (session != null) {
			return frmDate.format(session.getSessionDate());
		} else {
			return frmDate.format(new Date());
		}
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return Id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		Id = id;
	}
	
	
}
